﻿using Autofac;
using Project.Yan.Net.BLL;
using Project.Yan.Net.Redis.Helper;
using Project.Yan.Net.Redis.RedisBase;
using Project.Yan.Net.Tool.Log;

namespace Project.Yan.Net.Autofac
{
    public class BLLModule: Module
    {
        protected override void Load(ContainerBuilder builder)
        {
            //注入Redis
            builder.RegisterType<RedisRepository>().As<IRedisRepository>().InstancePerLifetimeScope();

            builder.RegisterType<LoggerService>().As<ILoggerService>().SingleInstance();
            builder.RegisterAssemblyTypes(typeof(UserService).Assembly).Where(x => x.FullName.EndsWith("Service")).AsSelf().AsImplementedInterfaces();

            builder.RegisterAssemblyTypes(typeof(UserCacheHelper).Assembly).Where(x => x.FullName.EndsWith("Helper")).AsSelf().AsImplementedInterfaces();

            
        }
    }
}
